using System;

namespace Avinor.NET
{
    public class FlightsQuery
    {
        public FlightsQuery(string airport)
        {
            Query = "airport=" + airport;
        }

        public string Query { get; private set;}

        public FlightsQuery Arrivals()
        {
            AddDirection("A");
            return this;
        }

        void AddDirection(string direction)
        {
            Query += "&direction=" + direction;
        }

        public FlightsQuery Departures()
        {
            AddDirection("D");
            return this;
        }

        public FlightsQuery HoursBack(int hours)
        {
            Query += "&timeFrom=" + hours;
            return this;
        }

        public FlightsQuery HoursForward(int hours)
        {
            Query += "&timeTo=" + hours;
            return this;
        }

        public FlightsQuery UpdatedAfter(DateTime lastUpdated)
        {
            Query += "&lastUpdate=" + lastUpdated.ToString("yyyy-MM-ddThh:mm:ss");
            return this;
        }
    }
}